package ztttt1;

import java.util.*;
//棋盘(⭐⭐)
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int[][] s = new int[n+5][n+5];
        while(m-- > 0){
            int x1 = scan.nextInt();
            int y1 = scan.nextInt();
            int x2 = scan.nextInt();
            int y2 = scan.nextInt();
            Donum(x1,y1,x2,y2,s);
        }
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                s[i][j] += s[i-1][j] + s[i][j-1] - s[i-1][j-1];
                System.out.print(s[i][j]%2);
            }
            System.out.println();
        }
    }
    public static void Donum(int x1,int y1,int x2,int y2,int[][] arr){
        arr[x1][y1] += 1;
        arr[x2+1][y1] -= 1;
        arr[x1][y2+1] -= 1;
        arr[x2+1][y2+1] += 1;
    }
}
//闪耀的灯光(⭐⭐)
class Main2 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int c = scan.nextInt();
        //初始数组
        int[][] a = new int[n + 5][m + 5];
        //二维前缀和数组
        long[][] s = new long[n + 5][m + 5];
        for(int i = 1;i <= n;i++){
            for(int j = 1;j <= m;j++){
                a[i][j] = scan.nextInt();
                s[i][j] = a[i][j] + s[i-1][j] + s[i][j-1] - s[i-1][j-1];
            }
        }
        //t次操作
        int t = scan.nextInt();
        while(t-- > 0){
            //操作后的整体亮度
            long num = 0;
            //该区域内减少的亮度
            long sub = 0;
            int x1 = scan.nextInt();
            int y1 = scan.nextInt();
            int x2 = scan.nextInt();
            int y2 = scan.nextInt();
            int k = scan.nextInt();
            //当按c次时,亮度减少到最低,按(c+1)次时,亮度恢复
            k %= (c + 1);
            sub = ((long)(x2 - x1 + 1) *(y2 - y1 + 1) * k);
            num = s[x2][y2] - s[x2][y1-1] - s[x1-1][y2] + s[x1-1][y1-1] - sub;
            System.out.println(num);
        }
    }
}
//ROG(⭐⭐⭐)
class Main3 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int temp = 998244353;
        int n = scan.nextInt();
        int m = scan.nextInt();
        //储存ROG个数
        long num = 0;
        //存储字符矩阵
        char[][] s0 = new char[n + 10][m + 10];
        //存储'R','G'个数,[0]存储'R',[1]存储'G'
        long[][][] s = new long[n + 10][m + 10][3];
        //统计矩阵中'R','G'个数
        for(int i = 1;i <= n;i++) {
            String str = scan.next();
            for(int j = 1;j <= m;j++) {
                s0[i][j] = str.charAt(j - 1);
                if(s0[i][j] == 'R') {
                    s[i][j][0]++;
                }
                if(s0[i][j] == 'G') {
                    s[i][j][1]++;
                }
            }
        }
        //求'R'的二位前缀数组
        for (int i = 1; i <= n; i++) {
            for(int j = 1;j <= m;j++) {
                s[i][j][0] = (s[i][j][0] + s[i - 1][j][0] + s[i][j - 1][0]
                        - s[i - 1][j - 1][0] + temp) % temp;
                s[i][j][0] %= temp;
            }
        }
        //求'O'的二位前缀数组
        for (int i = n; i >= 1; i--) {
            for(int j = m;j >= 1;j--) {
                s[i][j][1] = (s[i][j][1] + s[i + 1][j][1] + s[i][j + 1][1]
                        - s[i + 1][j + 1][1] + temp) % temp;
                s[i][j][1] %= temp;
            }
        }

        for (int i = 1; i <= n; i++) {
            for(int j = 1;j <= m;j++) {
                if(s0[i][j] == 'O') {
                    num += (s[i][j][0] * s[i][j][1]) % temp;
                    num %= temp;
                }
            }
        }
        System.out.println(num);
    }
}
//相或为k(⭐⭐)
class Main4 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int t = scan.nextInt();
        while(t-- > 0) {
            int n = scan.nextInt(),k = scan.nextInt();
            int num = 0;
            // & -> 同1为1 否则为0
            // 如果 ((h & k) == h) 就代表'h'的二进制与'k'相比,没有多余的1
            // 而想用 '|' 操作符得到 'k'的前提条件就是必须"没有多余的1";
            // 所以我们用(num|)将'h'中的'1'进行存储。
            // 当最后的'num'如果能与'k'相等,代表存在两个输入过的数字能通过'|'得到'k'
            for(int i = 1;i <= n;i++) {
                int h = scan.nextInt();
                if((h & k) == h) {
                    num |= h;
                }
            }
            if(num == k) {
                System.out.println("Yes");
            }else {
                System.out.println("No");
            }
        }
    }
}